Restoring Links from target module.

I am facing a very strange problem.

I can see inlink ( yellow arrow) in my target modules. But when I am following the link ( by Clicking Follow Link tab of object properties) I am able to go to object in the source module. But there is no link in the history of the source module. nor I am finding Pink arrow showing outlink on the source object.

Is there any way I can restore these links from the target module?
Any DXL to restore the linking and all will be very helpful because there are around 2000 linking I have done. I don’t want to repeat the process again. 

Please help.
Thanks and Regards
AJ
DOORS_AJ - Mon May 24 15:13:10 EDT 2010

Re: Restoring Links from target module.
llandale - Mon May 24 17:43:04 EDT 2010

I think the follow link will find an object NEAR the link-source-object, if that source is excluded from the current view. It may also happen when the source object is deleled. But I see you get an error box when you do these things.

This sounds familiar.

Anyway, lets re-create all links we can find. I'll scribble down some code without trying it, good luck.

// open module edit
Object obj, oSource, oTarget
ModName_ mn
LinkRef  lr
Link     lnk, lNew
Module   mLM, mSource, mTarget
string   ErrMess
 
Module   mCurr = current
 
for obj in entire mCurr do
{  if (isDeleted(obj)) continue
   for lr in obj <-"*" do
   {  mn = source(lr)
      edit(fullName(mn))
   } // end opening all source modules Edit
   for lnk in obj <-"*" do
   {  mLM = module(lnk)
      oSource = source(lnk)
      mSource = module(source(lnk))
      if (null mSource !isEdit(mSource)) continue, log some error first
      if (null oSource) continue,log some error
      if (null mLM)     cOntinue, log some error
      noError()
      lNew = oSource ->fullName(mLM) ->obj
      ErrMess = lastError()
      if (null lNew or !null ErrMess) log create-link error; except link already exists
   }  // end re-creating in-links
 
   for lnk in obj ->"*" do
   {  mTarget = target(lnk)
      edit(fullName(mTarget))
      mLM     = module(lnk)
      oTarget = target(lnk)
      if (null mTarget or !isEdit(mTarget)...
      if (null mLM) ...
      if (null oTarget) ...
      noError()
      lNew = obj -> fullName(mLM) ->oTarget
      ErrMess = lastError()
      if (null lNew or !null ErrMess) log create-link error, unless its a link-aleady exists error
   }     // end re-creating outlinks
}   // end for all objects
 
for mSource in database do
{  if (isEdit(mSource))  save(mSource)
   if (mSource != mCurr) close(mSource)
}    // end closing residual open modules

Re: Restoring Links from target module.
DOORS_AJ - Mon May 24 18:53:18 EDT 2010

llandale - Mon May 24 17:43:04 EDT 2010

I think the follow link will find an object NEAR the link-source-object, if that source is excluded from the current view. It may also happen when the source object is deleled. But I see you get an error box when you do these things.

This sounds familiar.

Anyway, lets re-create all links we can find. I'll scribble down some code without trying it, good luck.

// open module edit
Object obj, oSource, oTarget
ModName_ mn
LinkRef  lr
Link     lnk, lNew
Module   mLM, mSource, mTarget
string   ErrMess
 
Module   mCurr = current
 
for obj in entire mCurr do
{  if (isDeleted(obj)) continue
   for lr in obj <-"*" do
   {  mn = source(lr)
      edit(fullName(mn))
   } // end opening all source modules Edit
   for lnk in obj <-"*" do
   {  mLM = module(lnk)
      oSource = source(lnk)
      mSource = module(source(lnk))
      if (null mSource !isEdit(mSource)) continue, log some error first
      if (null oSource) continue,log some error
      if (null mLM)     cOntinue, log some error
      noError()
      lNew = oSource ->fullName(mLM) ->obj
      ErrMess = lastError()
      if (null lNew or !null ErrMess) log create-link error; except link already exists
   }  // end re-creating in-links
 
   for lnk in obj ->"*" do
   {  mTarget = target(lnk)
      edit(fullName(mTarget))
      mLM     = module(lnk)
      oTarget = target(lnk)
      if (null mTarget or !isEdit(mTarget)...
      if (null mLM) ...
      if (null oTarget) ...
      noError()
      lNew = obj -> fullName(mLM) ->oTarget
      ErrMess = lastError()
      if (null lNew or !null ErrMess) log create-link error, unless its a link-aleady exists error
   }     // end re-creating outlinks
}   // end for all objects
 
for mSource in database do
{  if (isEdit(mSource))  save(mSource)
   if (mSource != mCurr) close(mSource)
}    // end closing residual open modules

Hi,

I found 26 errors in the script.Can you please help me to resolve these errors.

I think by mistake you commited some syntax errors in the script. i.e countinue on line 21st.

I am new to DXL.Please suggest

Re: Restoring Links from target module.
Mathias Mamsch - Tue May 25 02:54:51 EDT 2010

Before creating links by some script I would suggest you first check what is going on with you links:

1. go to the link properties of one of the "missing" links and note the source ID (Absolute Number of Source Object), the source FULL name, the target ID (Absolute Number of Target Object), the target module full name and the link module full name

2. Open the right source module, press Ctrl-G (goto) enter the source ID to go to the object. Check that the object really has the correct Absolute Number.

3. Go to the link properties of the source object. Check if the link is there.

4. Check your access to the source module, target module and the link module in the module properties. Make sure you have read access to all of them.

Check if you get a message "Source object of the link has been deleted" when you follow the link. If source object and target object are there and you have access to everything and the source link arrows still don't show up you are either facing data corruption of your module or you might face this problem because of your DOORS environment (I experienced the problem of link arrows disappearing and reapperaring in a citrix environment once).

I would not resort to just ignoring the problem and only recreating the links.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Restoring Links from target module.
DOORS_AJ - Tue May 25 13:35:29 EDT 2010

Mathias Mamsch - Tue May 25 02:54:51 EDT 2010
Before creating links by some script I would suggest you first check what is going on with you links:

1. go to the link properties of one of the "missing" links and note the source ID (Absolute Number of Source Object), the source FULL name, the target ID (Absolute Number of Target Object), the target module full name and the link module full name

2. Open the right source module, press Ctrl-G (goto) enter the source ID to go to the object. Check that the object really has the correct Absolute Number.

3. Go to the link properties of the source object. Check if the link is there.

4. Check your access to the source module, target module and the link module in the module properties. Make sure you have read access to all of them.

Check if you get a message "Source object of the link has been deleted" when you follow the link. If source object and target object are there and you have access to everything and the source link arrows still don't show up you are either facing data corruption of your module or you might face this problem because of your DOORS environment (I experienced the problem of link arrows disappearing and reapperaring in a citrix environment once).

I would not resort to just ignoring the problem and only recreating the links.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Thanks for the input.
But I am not able to find the these IDs in the properties.

I will love to do it by DXL.Beucase I have 3500 links in this module. Becuase Its the only way which will make my life easy.

Please help.

Thanks and Regards,
AJ

Re: Restoring Links from target module.
llandale - Tue May 25 13:47:06 EDT 2010

DOORS_AJ - Mon May 24 18:53:18 EDT 2010
Hi,

I found 26 errors in the script.Can you please help me to resolve these errors.

I think by mistake you commited some syntax errors in the script. i.e countinue on line 21st.

I am new to DXL.Please suggest

Sorry, I'm not going to write this script.

Link History 'existed' but was not recorded until DOORS v8.

Read Mathias' post again carefully. If you are in the Target module and the object->link properties does not state the source module/absno, then its unlikely my script will do anything since they both surely use the 'source' functions to figure out those sources.

I wonder if you can see the links if you lack R access to the link module. I wonder what happens when you lack R rights to the source Object.

  • Louie

Re: Restoring Links from target module.
Mathias Mamsch - Tue May 25 15:13:08 EDT 2010

DOORS_AJ - Tue May 25 13:35:29 EDT 2010
Thanks for the input.
But I am not able to find the these IDs in the properties.

I will love to do it by DXL.Beucase I have 3500 links in this module. Becuase Its the only way which will make my life easy.

Please help.

Thanks and Regards,
AJ

The problem is that as long as we don't know what is going on with your links, we cannot write a script. We have three possibilities:

a) your links point to deleted objects
b) you are lacking access to the link module
c) you have corrupt data in your module

do the following for starters - Run the below script. Check the output! If the tool reports stale links then locate the scripts results in the Edit DXL Window, copy paste the result to a text file and post it back here. Then we can give you a script to restore the links.

Regards, Mathias
 

/*
Kitchen Tools for customizing DOORS with DXL V7.1
-------------------------------------------------
DISCLAIMER:

This programming tool has been thoroughly checked 
and tested at all stages of its production. 
Telelogic cannot accept any responsibility for 
any loss, disruption or damage to your data or 
your computer system that may occur while using 
this script. 

If you do not accept these conditions, do not use 
this customised script.
-------------------------------------------------
*/
 
// Copyright (c) 1999 Quality Systems & Software Ltd.
// See DOORS manuals for copying conditions
 
/*
  Sometimes, when you delete modules and objects, links are left hanging around.
  This script fixes it.
*/
 
// Revised by kw 29/09/99: corrected some bugs and hazards (see below)
 
 
 
 
// skip list to record links to delete
Skip linksToDelete = create
 
// go through all (incoming- and outgoing-) links of object o and look for null links
int findDudLinks(Object o, string lnkModName) {
  Object s
  int count = 0
  // record current module
  Module currMod = current
 
  // open all linked modules
  LinkRef lr
  for lr in o<-lnkModName do
  {
    string mn = fullName(source(lr))
    if (exists module mn && !isDeleted module mn) edit(mn, false)    // check if module esists at all and is not deleted
  }
    
  // check incoming links
  Link l
  for l in o<-lnkModName do {
    s = source l
    if ( null s ) {
      put(linksToDelete, l, l)
      count++
    }  
  }
 
  // check outgoing links
  for l in o->lnkModName do {
    s = target l
    if ( null s ) {
      string mn = fullName(target l)           // load targets module !
      // check that the module esists at all and is not deleted
      if (exists module mn && !isDeleted module mn) read(mn, false)
      s = target l
    }
    if ( null s ) {  
      put(linksToDelete, l, l)
      count++
    }  
  }
 
  // restore current module
  current = currMod  
  return count
}
 
 
string modName
Object o
Link l
int n = 0
 
Item it
for it in current Project do 
{  // go through all modules in current project
 
  modName = fullName(it)
  if ( null module modName || type module modName != "Formal" || modName == "Users")
    continue
  
  Module m = read(modName, false)
//  print "Modul: " modName "\n"
  for o in m do 
    n += findDudLinks(o, "*")
 
  if ( n == 0 ) {
    print "No stale links to delete in " m."Name" "."
    continue
  }  
 
  // delete links
  for l in linksToDelete do {
    string srcName = source l
    string tgtName = target l
    string modName = fullName module l
    print "Stale Link: " srcName ":" (sourceAbsNo l) " -> " modName " -> " tgtName ":" (targetAbsNo l) "\n"
    
  }  
  flushDeletions
}  
 
delete linksToDelete

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Restoring Links from target module.
norbyn-11 - Mon Jun 14 10:24:37 EDT 2010

I have a question regarding restoring links as well, I want to be able to retain the link information attached to a module after i close that module. The script needs to give the user the option of carrying links through from a previous baseline to the most recent baseline. But once I close the baseline it loses that information, but having too many baselines open at once causes DOORS to crash.

Can anyone help with this?
Thank you!

Re: Restoring Links from target module.
SystemAdmin - Wed Dec 12 18:13:11 EST 2012

Mathias Mamsch - Tue May 25 15:13:08 EDT 2010

The problem is that as long as we don't know what is going on with your links, we cannot write a script. We have three possibilities:

a) your links point to deleted objects
b) you are lacking access to the link module
c) you have corrupt data in your module

do the following for starters - Run the below script. Check the output! If the tool reports stale links then locate the scripts results in the Edit DXL Window, copy paste the result to a text file and post it back here. Then we can give you a script to restore the links.

Regards, Mathias
 

/*
Kitchen Tools for customizing DOORS with DXL V7.1
-------------------------------------------------
DISCLAIMER:

This programming tool has been thoroughly checked 
and tested at all stages of its production. 
Telelogic cannot accept any responsibility for 
any loss, disruption or damage to your data or 
your computer system that may occur while using 
this script. 

If you do not accept these conditions, do not use 
this customised script.
-------------------------------------------------
*/
 
// Copyright (c) 1999 Quality Systems & Software Ltd.
// See DOORS manuals for copying conditions
 
/*
  Sometimes, when you delete modules and objects, links are left hanging around.
  This script fixes it.
*/
 
// Revised by kw 29/09/99: corrected some bugs and hazards (see below)
 
 
 
 
// skip list to record links to delete
Skip linksToDelete = create
 
// go through all (incoming- and outgoing-) links of object o and look for null links
int findDudLinks(Object o, string lnkModName) {
  Object s
  int count = 0
  // record current module
  Module currMod = current
 
  // open all linked modules
  LinkRef lr
  for lr in o<-lnkModName do
  {
    string mn = fullName(source(lr))
    if (exists module mn && !isDeleted module mn) edit(mn, false)    // check if module esists at all and is not deleted
  }
    
  // check incoming links
  Link l
  for l in o<-lnkModName do {
    s = source l
    if ( null s ) {
      put(linksToDelete, l, l)
      count++
    }  
  }
 
  // check outgoing links
  for l in o->lnkModName do {
    s = target l
    if ( null s ) {
      string mn = fullName(target l)           // load targets module !
      // check that the module esists at all and is not deleted
      if (exists module mn && !isDeleted module mn) read(mn, false)
      s = target l
    }
    if ( null s ) {  
      put(linksToDelete, l, l)
      count++
    }  
  }
 
  // restore current module
  current = currMod  
  return count
}
 
 
string modName
Object o
Link l
int n = 0
 
Item it
for it in current Project do 
{  // go through all modules in current project
 
  modName = fullName(it)
  if ( null module modName || type module modName != "Formal" || modName == "Users")
    continue
  
  Module m = read(modName, false)
//  print "Modul: " modName "\n"
  for o in m do 
    n += findDudLinks(o, "*")
 
  if ( n == 0 ) {
    print "No stale links to delete in " m."Name" "."
    continue
  }  
 
  // delete links
  for l in linksToDelete do {
    string srcName = source l
    string tgtName = target l
    string modName = fullName module l
    print "Stale Link: " srcName ":" (sourceAbsNo l) " -> " modName " -> " tgtName ":" (targetAbsNo l) "\n"
    
  }  
  flushDeletions
}  
 
delete linksToDelete

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Do you know if a solution was ever found to this problem as I seem to have it now. The "Parent" document doesn't recognize the in links from the "child" document initially. If I go into the "child" document, it will show an outlink to the Parent document (abosulute numbers verified). If I "follow" the link in the properties menu, the link will then show up in the Parent document.

Also, in each document, I created parent and child views. Even though the Parent document doesn't acknowledge the in-links through "child views", the "child" document recognizes all of the parents in the "parents views.

I can definitely say that they are not deleted objects, I do not have access issues, and since I can get the link to show up in both documents by "following" it, I know its there.

However, the database that I am working in was restored from an archive. The original database does not show this issue.

It would help alot to not have to "follow" every link

Any thoughts?

HNP

Heidi

Re: Restoring Links from target module.
SystemAdmin - Wed Dec 12 18:33:01 EST 2012

SystemAdmin - Wed Dec 12 18:13:11 EST 2012
Do you know if a solution was ever found to this problem as I seem to have it now. The "Parent" document doesn't recognize the in links from the "child" document initially. If I go into the "child" document, it will show an outlink to the Parent document (abosulute numbers verified). If I "follow" the link in the properties menu, the link will then show up in the Parent document.

Also, in each document, I created parent and child views. Even though the Parent document doesn't acknowledge the in-links through "child views", the "child" document recognizes all of the parents in the "parents views.

I can definitely say that they are not deleted objects, I do not have access issues, and since I can get the link to show up in both documents by "following" it, I know its there.

However, the database that I am working in was restored from an archive. The original database does not show this issue.

It would help alot to not have to "follow" every link

Any thoughts?

HNP

Heidi

Would be handy to know what version of DOORS you're using - let us know the Client Version & Build Number information as it appears when you select the Help > About DOORS menu option


Paul Miller,
Melbourne, Australia

Re: Restoring Links from target module.
SystemAdmin - Wed Dec 12 18:37:09 EST 2012

SystemAdmin - Wed Dec 12 18:33:01 EST 2012
Would be handy to know what version of DOORS you're using - let us know the Client Version & Build Number information as it appears when you select the Help > About DOORS menu option


Paul Miller,
Melbourne, Australia

ooops, posted too quickly, supply the Server Version info as well as it appears in the Help > About DOORS menu as well

Paul Miller,
Melbourne, Australia

Re: Restoring Links from target module.
llandale - Thu Dec 13 15:24:31 EST 2012

SystemAdmin - Wed Dec 12 18:13:11 EST 2012
Do you know if a solution was ever found to this problem as I seem to have it now. The "Parent" document doesn't recognize the in links from the "child" document initially. If I go into the "child" document, it will show an outlink to the Parent document (abosulute numbers verified). If I "follow" the link in the properties menu, the link will then show up in the Parent document.

Also, in each document, I created parent and child views. Even though the Parent document doesn't acknowledge the in-links through "child views", the "child" document recognizes all of the parents in the "parents views.

I can definitely say that they are not deleted objects, I do not have access issues, and since I can get the link to show up in both documents by "following" it, I know its there.

However, the database that I am working in was restored from an archive. The original database does not show this issue.

It would help alot to not have to "follow" every link

Any thoughts?

HNP

Heidi

Haven't seen this bug for a while. The solution is to simply access every such link. Although the symtom is in the Target module, the solution is in the source module.

Module mSource = edit(NameSource)
Object obj
Link   lnk
Date   dat
for obj in entire (current Module) do
{  for lnk in all obj->"*" do
   {  dat = lnk."Created On"  // Not sure what this does, but it seems to "activate" the link
   }
}
save(mSource)  // even though no changes are made
close(mSource)


-Louie